{% extends 'base.html' %}

{% block head %}
    {% if not sort %}
        <title>添加分类-在线不聊天</title>
    {% else %}
        <title>编辑分类-在线不聊天</title>
    {% endif %}

{% endblock %}

{% block content %}
<div class="simpleui-box simpleui-row">
    {% if not sort %}
    <form method="POST" action="/sorts" class="simpleui-form">
        <label class="simpleui-form-label">分类名称:</label><input type="text" name="name" autocomplete="off" required placeholder="请输入名称"><br>
        <div class="simpleui-input-block">
            <input type="submit" value="添加">
            <a href="/sorts"><input type="button" value="取消"></a>
        </div>
    </form>

    {% else %}

    <form method="POST"  class="simpleui-form">
        <input type="hidden" name="_method" value="PUT"><!--由于 form 表单不支持 put/delete , 这个使用参数欺骗-->
        <label class="simpleui-form-label">分类名称:</label><input type="text" name="name" autocomplete="off" required value="{{ sort.name }}"><br>
        <div class="simpleui-input-block">
            <input type="submit" value="保存">
            <a href="/sorts"><input type="button" value="取消"></a>
        </div>
    </form>

    {% endif %}

</div>
{% endblock %}
